<?php

/**
 * USUARIO filter form base class.
 *
 * @package    dietas
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseUSUARIOFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellido'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fecha_nac'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'email'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'altura'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'sexo'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cintura'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cuello'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cadera'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'tipo_actividad' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TIPO_ACTIVIDAD'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'nombre'         => new sfValidatorPass(array('required' => false)),
      'apellido'       => new sfValidatorPass(array('required' => false)),
      'fecha_nac'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'email'          => new sfValidatorPass(array('required' => false)),
      'altura'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'sexo'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cintura'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'cuello'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'cadera'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'tipo_actividad' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TIPO_ACTIVIDAD'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('usuario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'USUARIO';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'nombre'         => 'Text',
      'apellido'       => 'Text',
      'fecha_nac'      => 'Date',
      'email'          => 'Text',
      'altura'         => 'Number',
      'sexo'           => 'Number',
      'cintura'        => 'Number',
      'cuello'         => 'Number',
      'cadera'         => 'Number',
      'tipo_actividad' => 'ForeignKey',
    );
  }
}
